﻿/*************************************************************

                      Blur
                                  
//-----------------------------------------------------------								

***************************************************************/

import flash.filters.BlurFilter;
class Silly.Effect.Blur extends Silly.Effect.EffectTween
{
	public function Blur(mc:MovieClip, startBlurX:Number, endBlurX:Number, startBlurY:Number, endBlurY:Number, duration:Number)
	{
		this._aim = mc;
		//应用对象
		this._startX = startBlurX;
		//起始水平模糊量
		this._endX = endBlurX;
		//结束水平模糊量
		this._startY = startBlurY;
		//起始垂直模糊量
		this._endY = endBlurY;
		//结束垂直模糊量
		this._currentX = 0;
		this._currentY = 0;
		//动画当前的水平和垂直模糊量
		this._duration = Math.round (duration / 2);
		//动画持续时间，因为有_tweenX和_tweenY同时在刷新，所以时间上去一半
		effectToMc (this._aim, this._startX, this._startY);
		//初始化应用对象
	}
	public function effectToMc (mc:MovieClip, xNum:Number, yNum:Number):Void
	{
		if (typeof (mc) == "movieclip") {
			this._aim = mc;
		}
		xNum == undefined ? xNum = 10 : [];
		yNum == undefined ? yNum = 10 : [];
		var filter:BlurFilter = new BlurFilter (xNum, yNum, this._quality);
		//生成虚化效果
		this._aim.filters = new Array (filter);
		delete filter;
		//转移到数组并附加到应用对象
	}
	
}
